package com.huawei.appmarket.service.store.awk.node;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import com.huawei.appmarket.framework.activity.AppWelfareListActivityProtocol;
import com.huawei.appmarket.framework.activity.AppWelfareListActivityProtocol.Request;
import com.huawei.appmarket.service.store.awk.card.HorizontalAppWelfareCard;
import com.huawei.appmarket.service.store.awk.widget.horizon.BaseHorizonCard;
import java.util.ArrayList;
import o.azb;
import o.cdr;
import o.cgz;
import o.cht$d;
import o.chy;
import o.chz;
import o.cil;
import o.cim.a;
import o.cjk;
import o.cjm;
import o.cjo;
import o.dgm;
import o.Logger;
import o.dyk;
import o.eib;
import o.ewm.e;
import o.ewm.h;
import o.ewm.j;
import o.ewm.n;

public class HorizontalAppWelfareNode extends cdr {
    private BaseHorizonCard ˊ;

    public HorizontalAppWelfareNode(Context context) {
        super(context, 0);
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        layoutParams.weight = 1.0f;
        this.ˊ = new HorizontalAppWelfareCard(this.ॱ);
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this.ॱ).inflate(h.ˋﾞ, null);
        ˎ(linearLayout);
        this.ˊ.ˏ((View) linearLayout);
        ˊ(this.ˊ);
        ((LinearLayout) linearLayout.findViewById(j.ʽʿ)).setTag(null);
        viewGroup.addView(linearLayout, layoutParams);
        return true;
    }

    public boolean ॱ(chz o_chz, ViewGroup viewGroup) {
        if (this.ˊ != null) {
            this.ˊ.ˊ(o_chz, ͺ());
        }
        return super.ॱ(o_chz, viewGroup);
    }

    public void ˋ(chy o_chy) {
        int i = 0;
        while (i < ˊॱ()) {
            cgz ˊ = ˊ(i);
            if (ˊ instanceof HorizontalAppWelfareCard) {
                final HorizontalAppWelfareCard horizontalAppWelfareCard = (HorizontalAppWelfareCard) ˊ;
                horizontalAppWelfareCard.ʻॱ().setOnClickListener(new cht$d(this, o_chy, horizontalAppWelfareCard) {
                    final /* synthetic */ HorizontalAppWelfareNode ˋ;

                    public void ˋ(View view) {
                        BaseCardBean baseCardBean = (BaseCardBean) horizontalAppWelfareCard.ˌ();
                        if (baseCardBean instanceof BaseDistCardBean) {
                            BaseDistCardBean baseDistCardBean = (BaseDistCardBean) horizontalAppWelfareCard.ˌ();
                            if (baseDistCardBean.ॱॱ() == null && baseDistCardBean.ˑ() == null) {
                                Logger.ˋ("HorizontalAppWelfareNode", "more layout onClick, detailId = " + baseDistCardBean.ॱॱ());
                                return;
                            }
                        }
                        cjo appWelfareListActivityProtocol = new AppWelfareListActivityProtocol();
                        Request request = new Request();
                        request.ˎ(baseCardBean.u_());
                        request.ˊ(baseCardBean.ॱॱ());
                        request.ˎ(true);
                        request.ˏ(n.ͺꜟ);
                        request.ॱ(e.ٴ);
                        request.ˊ(e.ˌॱ);
                        appWelfareListActivityProtocol.ˋ(request);
                        cjk.ˎ().ˋ(this.ˋ.ॱ, new cjm("appwelfare.list.activity", appWelfareListActivityProtocol));
                        cil.ˋ(this.ˋ.ॱ, new a(baseCardBean).ˏ(null).ˋ());
                        if (this.ˋ.ॱ instanceof Activity) {
                            new dyk(dgm.ˎ((Activity) this.ˋ.ॱ)).ॱ(baseCardBean);
                        }
                    }
                });
                horizontalAppWelfareCard.ˊ(o_chy);
                i++;
            } else {
                return;
            }
        }
    }

    public boolean ॱ() {
        return true;
    }

    private void ˎ(LinearLayout linearLayout) {
        azb.ˏ(linearLayout, j.ʿ);
    }

    public ArrayList<String> z_() {
        if (this.ˊ != null) {
            return this.ˊ.ͺ();
        }
        return null;
    }

    public int ˏ() {
        return eib.ʻ();
    }
}
